package com.jaydenxiao.common.basebean;

import java.io.Serializable;

/**
 * des:封装服务器返回数据
 * Created by xsf
 * on 2016.09.9:47
 */
public class BaseRespose<T> implements Serializable {

    public T d;

    private int tt;
    private int v;
    private String g;
    private boolean ie;
    private String E;
    private int S;//接口请求状态
    /**
     * Status	ExceptionString	Description
     * 0	Success	成功
     * 1	Unknown error	未知错误
     * 2	Unsupported openapi method	api接口不被支持
     * 3	Unauthorized client IP address:%s	api调用端的IP未被授权
     * 100	Invalid parameter	参数无效或缺失
     * 101	Invalid API key	token无效
     * 12001	Parameters format error	必选参数格式错误
     * 12002	Post str too long or short	提交字符串长度不合法
     * 12003	Invalid user	无效的用户信息，需要登录
     * 12004	User wealth is not enough	用户余额不足
     * 12005
     */

    private String ES;

    public boolean success(){
        return S==0;
    }

    @Override
    public String toString() {
        return "BaseRespose{" +
                "d=" + d +
                ", tt=" + tt +
                ", v=" + v +
                ", g='" + g + '\'' +
                ", ie=" + ie +
                ", E='" + E + '\'' +
                ", S=" + S +
                ", ES='" + ES + '\'' +
                '}';
    }

    public T getD() {
        return d;
    }

    public void setD(T d) {
        this.d = d;
    }

    public int getTt() {
        return tt;
    }

    public void setTt(int tt) {
        this.tt = tt;
    }

    public int getV() {
        return v;
    }

    public void setV(int v) {
        this.v = v;
    }

    public String getG() {
        return g;
    }

    public void setG(String g) {
        this.g = g;
    }

    public boolean isIe() {
        return ie;
    }

    public void setIe(boolean ie) {
        this.ie = ie;
    }

    public String getE() {
        return E;
    }

    public void setE(String e) {
        E = e;
    }

    public int getS() {
        return S;
    }

    public void setS(int s) {
        S = s;
    }

    public String getES() {
        return ES;
    }

    public void setES(String ES) {
        this.ES = ES;
    }

    public boolean isSuccessed(){
        return getS() == 0 ? true : false;
    }
}
